+ Reply to Thread + Post New Thread
Results 1 to 3 of 3

Thread: [VB.NET] How To Load A List Of Items From Text File Into A ListBox

  1. #1
    Registered Member
    Join Date
    Jun 2010
    Posts
    95
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default [VB.NET] How To Load A List Of Items From Text File Into A ListBox

    In this video tutorial you will learn how to Load A List Of Items In a Text File Into A List Box.

    Code:
    http://www.youtube.com/watch?v=IyS7oJlzb7c&feature=related

  2. Shorten URL    SEO Services    Buy Xrumer

    Sponsored Links

  3. #2
    Noobie
    Join Date
    Jan 2011
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default [VB.NET] How To Load A List Of Items From Text File Into A ListBox

    thanks for tut bro i need it

  4. #3
    Junior SEO Specialist
    Join Date
    Aug 2010
    Posts
    168
    Thanks
    0
    Thanked 86 Times in 55 Posts

    Default

    Or you could use:

    Code:
    OpenFileDialog1.Title = "Please select a text file"
            OpenFileDialog1.InitialDirectory = "C:\"
            OpenFileDialog1.ShowDialog()
    
            Dim FileToLoad As String
    
            FileToLoad = OpenFileDialog1.FileName.ToString()
    
            Dim fs As FileStream = New FileStream(FileToLoad, FileMode.Open)
    
            Dim sr As StreamReader = New StreamReader(fs)
    
            Do Until sr.EndOfStream
    
                ListBox1.Items.Add(sr.ReadLine())
    
            Loop
    
            sr.Close()
    
            fs.Close()
    And use it on button click.

    Hope it helps :)

+ Reply to Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts